<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<%@ page import="org.json.*"%>
<%@ page import="com.gzgi.framework.*"%>
<%@ page import="com.gzgi.framework.el.*"%>
<%@ page import="com.gzgi.framework.util.*"%>
<%@ page import="com.gzgi.framework.config.*"%>
<%@ page import="com.gzgi.framework.context.*"%>
<%@ page import="com.gzgi.framework.tree.*"%>
<%@ page import="com.gzgi.framework.dataitem.*"%>
<%@ page import="com.gzgi.framework.sys.*"%>
<%@ page import="com.gzgi.framework.sys.model.*"%>
<%@ page import="com.gzgi.framework.resource.*"%>
<%@ page import="com.gzgi.workflow.jbpm.model.*"%>
<%@ page import="com.gzgi.workflow.jbpm.container.*"%>
<%@ page import="com.gzgi.form.service.*"%>
<%@ page import="com.gzgi.form.graph.def.*"%>
<%@ page import="com.gzgi.form.graph.exe.*"%>
<%@ page import="com.gzgi.form.renderer.*"%>
<%@ page import="com.gzgi.form.integration.*"%>
<%@ page import="org.apache.commons.lang.*"%>
<%
     String actorId = (String) request.getSession().getAttribute(
				SecurityContext.LOGIN_ACTOR_ID);
	 String app_name = request.getParameter("app_name");
	 String rowId = request.getParameter("rowId"); 	 
 	 if( app_name == null) {
		 return;
	 }
	 
%>
<html>
<head>
<title>表单应用</title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/pages/styles/styles.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/scripts/ext/resources/css/ext-all.css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/ext/ext-all.js"></script>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/scripts/calendar/skins/aqua/theme.css"  />
<script src="<%=request.getContextPath()%>/scripts/calendar/calendar.js" language="javascript"></script>
<script src="<%=request.getContextPath()%>/scripts/calendar/lang/calendar-zh.js" language="javascript"></script>
<script src="<%=request.getContextPath()%>/scripts/calendar/calendar-setup.js" language="javascript"></script>
<script src="<%=request.getContextPath()%>/scripts/main.js" language="javascript"></script>
<script src="<%=request.getContextPath()%>/scripts/verify.js" language="javascript"></script>
<script src="<%=request.getContextPath()%>/scripts/ajax.js" language="javascript"></script>
<script src="<%=request.getContextPath()%>/scripts/jquery/jquery.min.js" language="javascript"></script>
<script src="<%=request.getContextPath()%>/scripts/jquery/jquery.form.js" language="javascript"></script>
<style type="text/css">
.logo {
	font-size: 28px;
	font-family: "华文楷体";
	text-decoration: none;
	color: white;
	font-weight: bold;
}
.logo-bar {
	padding-top: 0px;
}
.x-bar {
	font-weight: bold;
	color: #FFF;
}
.x-bar2 {
	font-weight: bold;
	color: #FFF;
	cursor: pointer;
}
</style>
<script language="javascript">

/**
 * 根据ID和link加载数据的共用方法
 */
function loadDataById(divId, link){
	$('#'+divId).load(link);
}

/**
 * 加载待办任务列表
 */
function loadTaskList(link){
	loadDataById('taskList', link);
}
/**
 * 加载公文正文
 */
function loadDocBody(link){
	loadDataById('doc_body', link);
}
/**
 * 加载右边的公文详细Panel
 */
function loadContentPanel(link){
	//loadDataById('contentPanel', link);
	 document.getElementById('contentPanel').src=link;
}

/**
 * 点击某个公文，加载正文、附件以及详细显示
 */
function loadDocData(rowId){
	loadDocBody('doc_body.jsp?app_name=<%=app_name%>&rowId='+rowId);
	loadDocAttach('doc_attach.jsp?app_name=<%=app_name%>&rowId='+rowId);
	loadContentPanel('<%=request.getContextPath()%>/FormService.do?actionType=render&x_method=submit&taskType=running&app_name=<%=app_name%>&rowId='+rowId);
}

//load doc attach
function loadDocAttach(link){
	loadDataById('doc_attach', link);
}

//reload the task task
function reloadTaskList(){
	loadTaskList('taskList.jsp?app_name=<%=app_name%>');
}

</script>
<script type="text/javascript">

	//待办任务工具栏
	var taskListToolbar = "待办任务&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:reloadTaskList();'>刷新列表</a>";

	//公文正文工具栏
	var docBodyToolbar = "<div style='float:left;'>公文正文</div>&nbsp;&nbsp;&nbsp;&nbsp;<img src='images/upload.gif' border=0 style='cursor:pointer;' onclick='alert(\"上传正文\");' alt='上传正文'/>";

	//公文附件工具栏
	var docAttachToolbar = "<div style='float:left;'>公文附件</div>&nbsp;&nbsp;&nbsp;&nbsp;<img src='images/upload.gif' border=0 style='cursor:pointer;' onclick='alert(\"上传附件\");' alt='上传附件'/>";

	//操作公文工具栏
	var contentToolbar = "<img src='images/todo_save.gif' border=0 onclick='alert(\"save\");' style='cursor:pointer'/>&nbsp;&nbsp;&nbsp;&nbsp;<img src='images/todo_send.gif' border=0 onclick='alert(\"send\");' style='cursor:pointer'/>&nbsp;&nbsp;&nbsp;&nbsp;<img src='images/todo_print.gif' border=0 onclick='alert(\"print\");' style='cursor:pointer'/>";


    Ext.onReady(function(){
        Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
        
       var viewport = new Ext.Viewport({
            layout:'border',
            items:[
                new Ext.BoxComponent({
                    region:'north',
                    el: 'north',
					hidden:true
                }),{
                    region:'west',
                    id:'west-panel',
                    title:taskListToolbar,
                    split:true,
                    width: 200,
                    minSize: 175,
                    maxSize: 300,
                    collapsible: true,
                    margins:'0 0 0 5',
                    layoutConfig:{
                        animate:false
                    },
                    items: [{
                        contentEl: 'taskList',
                        title:'任务列表',
                        border:false,
						height:250,
						autoScroll:true
                       },{
                        contentEl: 'doc_body',
                        title: docBodyToolbar,
                        border:false,
						height:100,
						autoScroll:true
                       },{
                        contentEl: 'doc_attach',
                        title: docAttachToolbar,
                        border:false,
						autoScroll:true
                       }]
				     },
                new Ext.FormPanel({
                    region:'center',
                    activeTab:0,
					collapsible: true,
                    items:[{
                        contentEl:'contentPanel',
						//autoHeight:true,
						height:650,
						border:false,
                        autoScroll:true
                    }]
                })
             ]
        });  
    });
</script>
</head>
<body id="x-body" leftmargin="0" topmargin="0" marginheight="0"	marginwidth="0">
<div id="north" class="logo-bar"></div>
<!-- 待办任务列表DIV -->
<div id="taskList"></div>
<!-- 公文正文DIV -->
<div id="doc_body"></div>
<!-- 公文附件DIV -->
<div id="doc_attach"></div>
<!-- 公文右边的Panel的DIV -->
<iframe id="contentPanel" align="center" width="100%" height="100%" scrolling="no" ></iframe>
<script language="javascript">
//刚进去时加载任务列表
loadDataById('taskList','taskList.jsp?app_name=<%=app_name%>');
//load content
<%if(StringUtils.isNotEmpty(rowId)){%> loadContentPanel('<%=request.getContextPath()%>/FormService.do?actionType=render&x_method=submit&taskType=running&app_name=<%=app_name%>&rowId=<%=rowId%>');
<%}else{%>	loadContentPanel('<%=request.getContextPath()%>/FormService.do?actionType=render&x_method=saveOrUpdate&taskType=draft&app_name=<%=app_name%>');
<%}%>
</script>
</body>
</html>

 